﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 第二次作业.entity
{
    internal class Bank
    {
        private Dictionary<string, Account> map = new Dictionary<string, Account>();

        public Account this[string key]
        {
            get
            {
                return map[key];
            }
            set
            {
                map[key] = value;
            }
        }

        public void addAccount(Account account)
        {
            if (map.ContainsKey(account.accountName))
            {
                throw new DuplicateNameException("账户已存在！");
            }
            map.Add(account.accountName, account);
        }
    }

    
}
